package gui;

import java.awt.FlowLayout;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;

public class ConnectionSettingsFrame extends JFrame {

	private ClientMainJFrame cmf;

	public ConnectionSettingsFrame(ClientMainJFrame cmf) {
		this.cmf = cmf;
		this.initGUI();
	}

	private void initGUI() {
		setTitle("Connect to AudioBuddy Server");
		setSize(300,200);
		this.setLayout(new FlowLayout());
		this.setLocationRelativeTo(null);
		this.setVisible(true);
		setupViews();
	}
		
	

	private void setupViews() {
		JPanel serverIpPanel = new JPanel();
		this.getContentPane().add(serverIpPanel);
		serverIpPanel.setLayout(new FlowLayout());
		serverIpPanel.setVisible(true);
		serverIpPanel.setBounds(30,30,80,30);
		JLabel txtIp = new JLabel();
		serverIpPanel.add(txtIp);
		String serverIp = null;
		while(serverIp==null){
			txtIp.setText("Looking for server IP address...");
			serverIp = cmf.getFoundServerIp();
			if(serverIp!=null){
				txtIp.setText(serverIp);
			}
		}
		
	}

}
